#include <iostream>
#include <vector>
#include <map>

extern const double EPSILON;
extern const double INF;

using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::pair;


class Graph
{
	vector< vector< int > > adjList; // the vertices achievable from each vertex (achievable -> dif of masses = 1 amino acid)
	vector< vector< int > > pathsInMasses;
	vector< vector< double > > foundSequences;
	vector < vector <int> > pathSymbols;

	vector <bool> visited;

	double ParentMass;
	int N;

	double sum(const int& i, const vector <double> &masses);
	void getPath(const int& v, const vector <double> &masses, vector <int>& path, const int& lenBoundDown, const int& lenBoundUp);
	void chooseSets(const vector <double> &masses);
	public:

	Graph(int N = 0) : adjList(N), ParentMass(0), pathsInMasses(0) // N - the number of peaks
	{
		this->N = N;
	}
	vector < int > &operator[] (int i);

	bool in(const vector< pair <double,char> > &amino_acids, double k);	
	bool in(const vector <int> &path, int k);

	void initialize( vector <double> &masses, const vector< pair <double,char> > &amino_acids);

	void getAminoAcidSequences(vector< pair <double,char> > &amino_acids, const vector <double> &masses);


	double pathWeight(const vector <int>& path, const vector <double> &masses);
	void pathStarter(const vector <double> &masses, const int& lenBoundDown = 0, const int& lenBoundUp = INF);

	void initialize(const vector <double> &masses);

};

